package com.design.twords.config;

import com.design.twords.R;
import com.design.twords.database.Word_all;

import org.litepal.LitePal;

/**
 * Create by Alen
 * Time:  15:08
 */
public class ConstantValue {

    // 数据存放目录（外置存储卡）
    public static final String DIR_TOTAL = "twords";
    // 解压后的数据目录
    public static final String DIR_AFTER_FINISH = "json";

    public static final int LEARN_WORD = 0x100;
    public static final int LOOK_WORD = 0x101;
    public static final int SEARCH_WORD = 0x102;

    // 书默认ID
    public static final int CET_4 = 1;
    public static final int CET_6 = 2;
    public static final int KAOYAN = 3;
    public static final int CET_6_ALL = 4;
    public static final int KAOYAN_ALL = 5;
    public static final int OCR = 6;
    public static final int TODAY_LISTENER = 7;

    // 根据书ID获取该书的单词总量
    public static String getTypeById(int bookId) {
        String type =null;
        switch (bookId) {
            case CET_4:
                type = "cet4";
                break;
            case CET_6:
                type = "cet6";
                break;
            case KAOYAN:
                type = "kaoyan";
                break;
            case CET_6_ALL:
                type = "cet6_all";
                break;
            case KAOYAN_ALL:
                type = "kaoyan_all";
                break;
            case OCR:
                type = "ocr";
                break;
        }
        return type;
    }
    // 根据书ID获取该书的单词总量
    public static int wordTotalNumberById(int bookId) {
        int num = 0;
        switch (bookId) {
            case CET_4:
                num = 1162;
                break;
            case CET_6:
                num = 1228;
                break;
            case KAOYAN:
                num = 1341;
                break;
            case CET_6_ALL:
                num = 2078;
                break;
            case KAOYAN_ALL:
                num = 4533;
                break;
            case OCR:
                num = LitePal.where("wordBook = ?","ocr").find(Word_all.class).size();
        }
        return num;
    }

    // 根据书ID获取该书的书名
    public static String bookNameById(int bookId) {
        String name = "";
        switch (bookId) {
            case CET_4:
                name = "英语四级核心词";
                break;
            case CET_6:
                name = "英语六级核心词";
                break;
            case KAOYAN:
                name = "考研必考词汇";
                break;
            case CET_6_ALL:
                name = "六级英语大纲";
                break;
            case KAOYAN_ALL:
                name = "考研英语大纲";
                break;
            case OCR:
                name = "OCR";
                break;
            case TODAY_LISTENER:
                name = "今日听写表";
                break;
        }
        return name;
    }

    // 根据书ID获取该书的图片
    public static int bookPicById(int bookId) {
        int picAddress = 0;
        switch (bookId) {
            case CET_4:
                picAddress = R.drawable.cet_4_pic;
                break;
            case CET_6:
                picAddress = R.drawable.cet_6_luan;
                break;
            case KAOYAN:
                picAddress = R.drawable.kaoyan_luan;
                break;
            case CET_6_ALL:
                picAddress = R.drawable.cet_6_all;
                break;
            case KAOYAN_ALL:
                picAddress = R.drawable.kaoyan_all;
                break;
            case OCR:
                break;
        }
        return picAddress;
    }

    // 根据书ID获取该书的下载地址
    public static String bookDownLoadAddressById(int bookId) {
        String picAddress = "";
        switch (bookId) {
            case CET_4:
                picAddress = "http://ydschool-online.nos.netease.com/1523620217431_CET4luan_1.zip";
                break;
            case CET_6:
                picAddress = "http://ydschool-online.nos.netease.com/1521164660466_CET6luan_1.zip";
                break;
            case KAOYAN:
                picAddress = "http://ydschool-online.nos.netease.com/1521164661106_KaoYanluan_1.zip";
                break;
            case CET_6_ALL:
                picAddress = "http://ydschool-online.nos.netease.com/1524052554766_CET6_2.zip";
                break;
            case KAOYAN_ALL:
                picAddress = "http://ydschool-online.nos.netease.com/1521164654696_KaoYan_2.zip";
                break;
        }
        return picAddress;
    }

    // 根据书ID获取该书的下载后的文件名
    public static String bookFileNameById(int bookId) {
        String picAddress = "";
        switch (bookId) {
            case CET_4:
                picAddress = "CET4luan_1.zip";
                break;
            case CET_6:
                picAddress = "CET6luan_1.zip";
                break;
            case KAOYAN:
                picAddress = "KaoYanluan_1.zip";
                break;
            case CET_6_ALL:
                picAddress = "CET6_2.zip";
                break;
            case KAOYAN_ALL:
                picAddress = "KaoYan_2.zip";
                break;
        }
        return picAddress;
    }


}
